package com.eastfair.auth.messagecenter;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 
 * </p>
 *
 * @author ligang
 * @date 2022-08-11
 */
@Getter
@AllArgsConstructor
public enum BusinessEnum implements BaseEnum {

    /**
     * MOBILE_LOGIN_CODE="手机号登录验证码"
     */
    MOBILE_LOGIN_CODE("手机号登录验证码"),

    /**
     * 站内信
     */
    LOGIN_SUCC_CODE("登录成功提示"),



    /**
     * OTHER="其他"
     */
    OTHER("其他"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static BusinessEnum match(String val, BusinessEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static BusinessEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(BusinessEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "P,P_VENUE,P_CERTIFICATE,P_COMPOSITE_VENUE,P_COMPOSITE_COURT,P_COMPOSITE_PRODUCER,P_COMPOSITE_TRANSPORT,P_COMPOSITE_TRADE,P_COMPOSITE_MATING,P_PAY,P_EXHIBITOR_SELF,P_CATERINGAPP,P_CATERING,P_PORTAL_OUT_VENUE,P_PORTAL_OUT_OPERATION,P_PORTAL_IN_WORK,P_PORTAL_IN_WORKAPP,P_OPERATION_CENTER,P_VISITOR_FRONT,P_VISITOR_BACK,P_R_EXHIBITOR,P_R_SPONSOR,P_R_BUILDER,P_R_COURT,P_R_TRANSPORT,P_R_BOOKING,P_R_REPAST,EXHIBITOR,EXHIBITOR_STAFF,SPONSOR,SPONSOR_STAFF,BUILDER,BUILDER_STAFF,COURT,COURT_STAFF,TRANSPORT,TRANSPORT_STAFF,BOOKING,BOOKING_STAFF,REPAST,REPAST_STAFF,STAFF,OTHER", example = "P")
    public String getCode() {
        return this.name();
    }

}
